package my.graduation.controller.doctor;

import my.graduation.dto.*;
import my.graduation.result.Result;
import my.graduation.service.DoctorService;
import my.graduation.vo.AdminVO;
import my.graduation.vo.DoctorLoginVO;
import my.graduation.vo.DoctorVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: RavenLyn
 * @Date: 2024-11-29
 */
@RestController
@RequestMapping("/doctor")
public class DoctorController {
    @Autowired
    private DoctorService doctorService;

    /**
     * 医生登录
     * @param dto
     * @return
     */
    @PostMapping("/login")
    public Result<DoctorLoginVO> doctorLogin(@RequestBody EmployeeLoginDto dto){
        // 0 医生
//        System.out.println(dto.getUsername());
        return doctorService.login(dto);
    }

    /**
     * 医生登出
     * @param dto
     * @return
     */
    @PostMapping("/logout")
    public Result doctorLogout(@RequestBody EmployeeLogoutDto dto){
        return doctorService.logout(dto);
    }


    /**
     * 医生获取个人信息
     * @param dto
     * @return
     */
    @PostMapping("/personal")
    public Result<DoctorVO> getPersonal(@RequestBody DoctorInfoDto dto){
        return doctorService.getPersonal(dto);
    }

    /**
     * 医生修改个人信息
     * @param dto
     * @return
     */
    @PutMapping("/modify")
    public Result modifyPersonal(@RequestBody DoctorInfoDto dto){
        return doctorService.update(dto);
    }

    /**
     * 医生修改密码
     * @param dto
     * @return
     */
    @PostMapping("/repass")
    public Result repass(@RequestBody RepassDto dto) {
        return doctorService.repass(dto);
    }
}
